package com.bst.bsj.common.dal.ibatis;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.bst.bsj.common.dal.daointerface.RoleDAO;
import com.bst.bsj.common.dal.dataobject.Role;
import com.sylinxsoft.tools.dao.impl.CommonBaseDAOImpl;

@Service("roleeDAO")
public class RoleDAOImpl extends CommonBaseDAOImpl implements RoleDAO {

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Override
  public List<Role> selectAll(Map paramsMap) {
    return (List<Role>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_SELECT", paramsMap);
  }

  @Override
  public Long selectAllCount(Map paramsMap) {
    return (Long) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_QUERY_COUNT", paramsMap);
  }
  
  @Override
  public int delete(Long id) {
    return getSqlMapClientTemplate().delete(getNameSpace() + ".MS_DELETE_BY_ID", id);
  }

  @Override
  public Long save(Role role) {
    return (Long) this.getSqlMapClientTemplate().insert(getNameSpace() + ".MS_INSERT", role);
  }

  @Override
  public int update(Role role) {
    return getSqlMapClientTemplate().update(getNameSpace() + ".MS_UPDATE", role);
  }

  @SuppressWarnings("unchecked")
  @Override
  public List<Role> selectAllParent() {
    return (List<Role>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_SELECT_PARENT");
  }

  @Override
  public Long selectExistCount(Map<String, Object> params) {
    return (Long) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_EXIST_COUNT", params);
  }

  @Override
  public List<Role> selectRoles(Map<String, Object> paramsMap) {
    return (List<Role>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_SELECT_ALL");
  }

 
  
}
